package com.xhl.doeverything.entity;//
// Source code recreated from a .class file by IntelliJ IDEA
// (powered by Fernflower decompiler)
//


import com.baomidou.mybatisplus.core.metadata.OrderItem;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;

@Data
@AllArgsConstructor
@Builder
public class PageQueryCondition<T> {
    public static final long DEFAULT_MAX_SIZE = 500L;
    private T model;
    private long size;
    private long current;
    private List<OrderItem> orders;
    private boolean searchCount;

    public PageQueryCondition() {
        this.size = 10L;
        this.current = 1L;
        this.orders = new ArrayList();
        this.searchCount = true;
    }

    public PageQueryCondition(long current, long size) {
        this(current, size, true);
    }

    public PageQueryCondition(long current, long size, boolean isSearchCount) {
        this.size = 10L;
        this.current = 1L;
        this.orders = new ArrayList();
        this.searchCount = true;
        if (current > 1L) {
            this.current = current;
        }

        this.size = size;
        this.searchCount = isSearchCount;
    }

    public PageQueryCondition<T> addOrder(OrderItem... items) {
        this.orders.addAll(Arrays.asList(items));
        return this;
    }

    public PageQueryCondition<T> addOrder(List<OrderItem> items) {
        this.orders.addAll(items);
        return this;
    }

}
